package com.zui.base;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.sun.istack.internal.NotNull;
import org.hibernate.id.enhanced.SequenceStyleGenerator;

@MappedSuperclass
public class BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	public final static String IS_DELETED_Y = "Y";
	public final static String IS_DELETED_N = "N";

	protected Long id;
	protected String description;
	protected String isDeleted = IS_DELETED_N;
	protected Date createdDate;
	protected String createdByUserLogin;
	protected Date lastModifiedDate;
	protected String lastModifiedByUserLogin;

	/**------------------------------
	 * getters and annotations
	 --------------------------------*/
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	public Long getId() {return id;}
	
	@Column(length=256)
	public String getDescription() {return description;}
	
	@Column(length=1) @NotNull
	public String getIsDeleted() {return isDeleted;}

	@Column(insertable=true,updatable=false)
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatedDate() {return createdDate;}

	@Column(length=20,insertable=true,updatable=false)
	public String getCreatedByUserLogin() {return createdByUserLogin;}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getLastModifiedDate() {return lastModifiedDate;}

	@Column(length=20)
	public String getLastModifiedByUserLogin() {return lastModifiedByUserLogin;	}

	/**------------------------------
	 * setters
	 --------------------------------*/
	public void setId(Long id) {this.id = id;}
	
	public void setDescription(String description) {
		this.description = description;
	}
	public void setIsDeleted(String isDeleted) {
		this.isDeleted = isDeleted;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	public void setCreatedByUserLogin(String createdByUserLogin) {
		this.createdByUserLogin = createdByUserLogin;
	}
	public void setLastModifiedDate(Date lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}
	public void setLastModifiedByUserLogin(String lastModifiedByUserLogin) {
		this.lastModifiedByUserLogin = lastModifiedByUserLogin;
	}
	
}
